package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.ArticleDAO;

/**
 * Servlet implementation class DeleteArticleServet
 */
@WebServlet("/DeleteArticleServet")
public class DeleteArticleServet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private static ArticleDAO articledao = ArticleDAO.getInstance(); 
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DeleteArticleServet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		int article_id =Integer.parseInt(request.getParameter("article_id"));
		articledao.delete(article_id);
		request.getRequestDispatcher("ManageServlet").forward(request, response);
	}

}
